package spoon.task;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import spoon.core.domain.Game;
import spoon.service.SbobetService;

@Component
public class SbobetFootballTask {

	@Autowired
	@Qualifier("sbobetFootballService")
	private SbobetService sbobetService;
	
	private List<Game> linkList = new ArrayList<Game>();
	
	//@Scheduled(fixedRateString = "${sbobet.football.delay}")
	public void taskGame() {
		// 링크 정보가 없을 경우 받아 온다.
		if (linkList.size() == 0) {
			this.linkList.addAll(sbobetService.getLinkList());
			return;
		}
		
		sbobetService.getGame(linkList.remove(0));
	}
	
}
